In these years, since moving image data has a large amount of data, the moving image data is subjected to high-efficiency encoding when transmitted from a transmission apparatus to a reception apparatus or when stored in a storage apparatus. The “high-efficiency encoding” is an encoding process in which a certain data string is converted into another data string, thereby reducing the amount of data.
Typical methods for encoding a moving image include International Organization for Standardization/International Electrotechnical Commission (ISO/IEC) Moving Picture Experts Group (MPEG)-2/MPEG-4 (hereinafter referred to as MPEG-2 and MPEG-4).
In MPEG-2, three types of pictures, namely I, P, and B, are defined. An I-picture is a picture obtained by performing an encoding process closed within a frame without referring to an encoded image of another picture. A P-picture is a picture obtained by encoding a prediction error by performing forward prediction from a past picture. A B-picture is a picture obtained by encoding a prediction error by performing bidirectional prediction from past and future pictures.
FIG. 1 is a diagram illustrating an example of a sequence having an IBBP structure. Numbers following Is, Ps, and Bs illustrated in FIG. 1 indicate the display order. In the example illustrated in FIG. 1, the display order is B0, B1, I2, B3, B4, P5, and so on.
In FIG. 1, the encoding order is I2, B0, B1, P5, B2, B3, and so on. As illustrated in FIG. 1, a delay is caused by B-pictures. Encoded data is accumulated in a buffer and output to a decoding device. Since intra-frame encoding is performed for I-pictures, the entirety of the pictures is refreshed. Therefore, propagation of errors may be suppressed by the I-pictures.
On the other hand, in a general moving image encoder, for example, a pre-processing unit, a predictive coding unit, a variable-length coding unit, and a multiplexing unit perform sequential processing (pipeline processing) for each picture. The pre-processing unit includes a picture rearranging unit that rearranges pictures in accordance with the picture types, and sequentially outputs frame images for each picture type and frame or the like.
In the predictive coding unit, a difference from a predicted image is obtained and orthogonal transformation and quantization are performed. In the variable-length coding unit, entropy coding is performed. In the multiplexing unit, data subjected to the entropy coding is multiplexed and a bit stream to be output is generated.
FIG. 2 is a diagram illustrating an example of the sequential processing for each picture. In the example illustrated in FIG. 2, each process is sequentially performed for each picture. A multiplexed bit stream is temporarily stored in a Coded Picture Buffer (CPB) and output to a decoder.
The CPB is a buffer that holds a bit stream before the bit stream is input to the decoder. The encoder controls the CPB such that a buffer on the decoder side does not fail. In a real-time processing system, delay caused by the CPB is the largest delay.
If the size of the CPB is increased, the quality of images improves, but the delay becomes larger. If the size of the CPB is decreased, the quality of images deteriorates, but the delay may be reduced. There is a trade-off between the size of the CPB and the quality of images. How the buffer delay may be reduced while maintaining the quality of images is being studied.
“CPB” is the name of a buffer according to H.264/Advanced Video Coding (AVC) (hereinafter also referred to as H.264). In MPEG, a CPB corresponds to a Video Buffer Verifier (VBV). In the following description, a CPB is used, but in the case of MPEG, the CPB may be replaced with a VBV.
A method has been disclosed in which, in order to reduce the delay in the real-time processing, a picture is divided into several slices and the slices are subjected to sequential processing. For example, in Japanese Laid-open Patent Publication Nos. 2000-224584, 2010-34802, and 2010-62946, methods have been disclosed in which the size of a slice (the number of macroblocks in a slice) is determined on the basis of the magnitude of a motion vector, the circuit capacity, and the number of codes written to the buffer.